home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Source Sea20778672001.psc / clsFiles.cls < prev    next >
Encoding:
Visual Basic class definition  |  2001-04-22  |  2.0 KB  |  106 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "clsFiles"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15.  
  16. 'The collection of all parents
  17. Private m_colParentFiles As Collection
  18.  
  19. Public Function IsParent(v_strPath As String) As Boolean
  20.  
  21.   On Error GoTo Err_Handle
  22.   
  23.   Dim lItem As clsParentFile
  24.   
  25.   Set lItem = m_colParentFiles.Item(v_strPath)
  26.   Set lItem = Nothing
  27.   
  28.   IsParent = True
  29.   Exit Function
  30.   
  31. Err_Handle:
  32.   Set lItem = Nothing
  33.   IsParent = False
  34.   
  35. End Function
  36.  
  37. Public Property Get Count() As Long
  38.  
  39.   Count = m_colParentFiles.Count
  40.  
  41. End Property
  42.  
  43. Public Function Add(ByVal v_strPath As String) As Boolean
  44.   
  45.   Dim objParentFiles As New clsParentFile
  46.   Dim x As Integer
  47.   
  48.   On Error Resume Next
  49.   
  50.   objParentFiles.Path = v_strPath
  51.   
  52.   If m_colParentFiles.Count > 0 Then
  53.     For x = 1 To m_colParentFiles.Count
  54.       If Item(x).Path = v_strPath Then Exit Function
  55.     Next x
  56.   End If
  57.   
  58.   m_colParentFiles.Add objParentFiles, v_strPath
  59.   
  60.   If Err.Number <> 0 Then
  61.     Add = False
  62.   Else
  63.     Add = True
  64.   End If
  65.   
  66.   Set objParentFiles = Nothing
  67.  
  68. End Function
  69.  
  70. Public Sub Clear()
  71.  
  72.   Dim x As Integer
  73.   
  74.   For x = m_colParentFiles.Count To 1 Step -1
  75.     m_colParentFiles.Remove x
  76.   Next x
  77.   
  78. End Sub
  79.  
  80. Public Function Remove(ByVal v_vntIndex As Variant)
  81.  
  82.   On Error Resume Next
  83.   m_colParentFiles.Remove v_vntIndex
  84.   
  85. End Function
  86.  
  87. Public Function Item(ByVal v_vntIndex As Variant) As clsParentFile
  88.  
  89.   On Error Resume Next
  90.   Set Item = m_colParentFiles.Item(v_vntIndex)
  91.   If Err.Number <> 0 Then
  92.     Set Item = Nothing
  93.   End If
  94.   
  95. End Function
  96.  
  97. Private Sub Class_Initialize()
  98.  
  99.   Set m_colParentFiles = New Collection
  100.   
  101. End Sub
  102.  
  103.  
  104.  
  105.  
  106.